import type { ProColumns } from '@ant-design/pro-table';

// 定义请求返回数据类型
export type ColumnsItem = {
  seqNo: number;
  custNo: string;
  rechargeMode: '00' | '01';
  amt: number;
  payNo: string;
  exgRate: string;
  fee: number;
  acNo: string;
  rcNo: string;
  createdTime: Date;
  recAmount: number;
  status: 0 | 1 | 2;
  remarks: string;
}

// 定义表头
let columnsData: ProColumns<ColumnsItem>[] = [
  {
    title: '交易流水号',
    dataIndex: 'rcNo',
    hideInTable: true,
    fieldProps: {
      maxLength: 20
    },
  },
  {
    title: '充值客户号',
    hideInTable: true,
    dataIndex: 'custNo',
    fieldProps: {
      maxLength: 20
    },
  },
  {
    title: '客户类型',
    hideInTable: true,
    dataIndex: 'custType',
    valueType: 'select',
    valueEnum: {
      'C': { text: '商户' },
      'P': { text: '会员' },
    },
  },
  {
    title: '交易结果',
    dataIndex: 'result',
    hideInTable: true,
    valueType: 'select',
    valueEnum: {
      0: { text: '交易中' },
      1: { text: '成功' },
      2: { text: '失败' },
    },
  },
  {
    title: '充值方式',
    dataIndex: 'type',
    hideInTable: true,
    valueType: 'select',
    valueEnum: {
      '00': { text: '法币' },
      '01': { text: '链钱包' },
    },
  },
  {
    title: '交易日期',
    dataIndex: 'created_at',
    hideInTable: true,
    valueType: 'dateRange',
    search: {
      transform: (value) => {
        return {
          startTime: value[0],
          endTime: value[1],
        };
      },
    },
  },

  // 上方查询，下方表头
  {
    title: '充值客户号',
    width: 160,
    fixed: 'left',
    hideInSearch: true,
    dataIndex: 'custNo',
    ellipsis: true,
  },
  {
    title: '客户类型',
    width: 100,
    fixed: 'left',
    hideInSearch: true,
    dataIndex: 'custType',
    valueType: 'select',
    valueEnum: {
      'C': { text: '商户' },
      'P': { text: '会员' },
    },
  },
  {
    title: '充值方式',
    width: 100,
    hideInSearch: true,
    dataIndex: 'rechargeMode',
    valueType: 'select',
    valueEnum: {
      '00': { text: '法币' },
      '01': { text: '链钱包' },
    },
  },
  {
    title: '付款账号||钱包地址',
    width: 160,
    hideInSearch: true,
    dataIndex: 'payNo',
  },
  {
    title: '充值金额',
    width: 140,
    hideInSearch: true,
    dataIndex: 'amt',
  },
  {
    title: '币种',
    width: 50,
    hideInSearch: true,
    dataIndex: 'ccy',
  },
  {
    title: '手续费',
    width: 140,
    hideInSearch: true,
    dataIndex: 'fee',
  },
  {
    title: '币种',
    width: 50,
    hideInSearch: true,
    renderText: () => 'HPC'
  },
  {
    title: '到账金额',
    hideInSearch: true,
    dataIndex: 'recAmount',
    width: 140,
  },
  {
    title: '币种',
    width: 50,
    hideInSearch: true,
    renderText: () => 'HPC'
  },
  {
    title: '充值汇率',
    width: 100,
    hideInSearch: true,
    dataIndex: 'exgRate',
  },
  {
    title: '货币对',
    width: 100,
    hideInSearch: true,
    dataIndex: 'ccyPair',
  },
  {
    title: '充值账号',
    width: 160,
    hideInSearch: true,
    dataIndex: 'acNo',
  },
  {
    title: '交易流水号',
    hideInSearch: true,
    dataIndex: 'rcNo',
    width: 160,
  },
  {
    title: '交易HASH',
    hideInSearch: true,
    dataIndex: 'txnHasH',
    width: 200,
  },
  {
    title: '交易时间',
    width: 160,
    hideInSearch: true,
    dataIndex: 'createdTime',
    valueType: 'dateTime'
  },
  {
    title: '交易结果',
    width: 80,
    hideInSearch: true,
    dataIndex: 'status',
    valueEnum: {
      0: { text: '交易中', status: 'Processing' },
      1: { text: '成功', status: 'Success' },
      2: { text: '失败', status: 'Error' },
    },
  },
  {
    title: '失败原因',
    width: 160,
    hideInSearch: true,
    dataIndex: 'remarks',
  }
]
export default columnsData;
